import 'package:flutter_test/flutter_test.dart';
import 'package:torch_controller/torch_controller.dart';
import 'package:torch_controller/torch_controller_platform_interface.dart';
import 'package:torch_controller/torch_controller_method_channel.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';

class MockTorchControllerPlatform
    with MockPlatformInterfaceMixin
    implements TorchControllerPlatform {

  @override
  Future<String?> getPlatformVersion() => Future.value('42');
}

void main() {
  final TorchControllerPlatform initialPlatform = TorchControllerPlatform.instance;

  test('$MethodChannelTorchController is the default instance', () {
    expect(initialPlatform, isInstanceOf<MethodChannelTorchController>());
  });

  test('getPlatformVersion', () async {
    TorchController torchControllerPlugin = TorchController();
    MockTorchControllerPlatform fakePlatform = MockTorchControllerPlatform();
    TorchControllerPlatform.instance = fakePlatform;

    expect(await torchControllerPlugin.getPlatformVersion(), '42');
  });
}
